//
//  YMMessageCell.swift
//  Driver
//
//  Created by lantaiyuan on 2017/10/26.
//  Copyright © 2017年 youmy. All rights reserved.
//

import UIKit

class YMMessageCell: UITableViewCell {
    
    

    @IBOutlet weak var timeLb: YMUILabel!
    @IBOutlet weak var msgTypeLb: UILabel!
    @IBOutlet weak var contentLb: UILabel!
    
    var model:YMMessage_Obj = YMMessage_Obj(){
        didSet{
            timeLb.text = timeStamp2time(model.gmtCreate)
            
            if model.title == ""{
                var str:String?
                str = "系统消息"
                msgTypeLb.text = str
            }else{
                msgTypeLb.text = model.title
            }
            
            contentLb.text = model.content
        }
    }
    
    func timeStamp2time(_ timeStamp: Int64) -> String {
        
        let dateFormatter = DateFormatter()
        
        dateFormatter.dateFormat = "MM月dd日 HH:mm"
        
        let date = Date(timeIntervalSince1970: TimeInterval(timeStamp/1000))
        
        return dateFormatter.string(from: date)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
